<template>
    <div class="box">
        <el-container style="width: 100%; height: 100%;">
            <el-header style="border-bottom:solid 1px red;">
                <div class="nana">
                    <img :src="sure.pic" alt="" srcset="">
                    <el-dropdown>

                        <span class="el-dropdown-link">

                            {{ sure.name }}
                            <el-icon class="el-icon--right">
                                <arrow-down />
                            </el-icon>
                        </span>
                        <template #dropdown>
                            <el-dropdown-menu>
                                <el-dropdown-item>登录</el-dropdown-item>
                                <el-dropdown-item @click="open">退出</el-dropdown-item>

                            </el-dropdown-menu>
                        </template>
                    </el-dropdown>
                </div>
            </el-header>
            <el-container>
                <el-aside width="200px" style="border-right:solid 1px red ; background-color:#545c64 ;">
                    <el-menu active-text-color="#ffd04b" background-color="#545c64" class="el-menu-vertical-demo"
                        default-active="/list/cabe" text-color="#fff" router>
                        <el-sub-menu index="1">
                            <template #title>
                                <el-icon>
                                    <location />
                                </el-icon>
                                <span>Navigator One</span>
                            </template>
                            <el-menu-item-group title="标题渲染">
                                <el-menu-item index="/list/cabe">账户查询</el-menu-item>
                                <el-menu-item index="/list/tabe">账户余额</el-menu-item>
                            </el-menu-item-group>
                            <el-menu-item-group title="Group Two">
                                <el-menu-item index="1-3">item three</el-menu-item>
                            </el-menu-item-group>
                            <el-sub-menu index="1-4">
                                <template #title>item four</template>
                                <el-menu-item index="1-4-1">item one</el-menu-item>
                            </el-sub-menu>
                        </el-sub-menu>
                        <el-menu-item index="2">
                            <el-icon><icon-menu /></el-icon>
                            <span>Navigator Two</span>
                        </el-menu-item>
                        <el-menu-item index="3" disabled>
                            <el-icon>
                                <document />
                            </el-icon>
                            <span>Navigator Three</span>
                        </el-menu-item>
                        <el-menu-item index="4">
                            <el-icon>
                                <setting />
                            </el-icon>
                            <span>Navigator Four</span>
                        </el-menu-item>
                    </el-menu>
                </el-aside>
                <el-main><router-view></router-view></el-main>
            </el-container>
        </el-container>
    </div>
</template>

<script setup>
import { ArrowDown } from '@element-plus/icons-vue'
import { reactive, ref } from 'vue'
import { getUserInfoApi } from "@/api/api"
import { ElMessage, ElMessageBox } from 'element-plus'

import { useRoute, useRouter } from 'vue-router'
const router = useRouter()

let sure = ref("")

const but = () => {
    getUserInfoApi().then((res) => {
        console.log(res);
        sure.value = res.data.data
    })
}
but()

const open = () => {
    ElMessageBox.confirm(
        '确定退出',
        'Warning',
        {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
         
        }
    )
        .then(() => {
            localStorage.clear('')
            router.push('/wang')
        })
        .catch(() =>{

        })
}

import {
  Document,
  Menu as IconMenu,
  Location,
  Setting,
} from '@element-plus/icons-vue'

</script>

<style lang="scss" scoped>
.box {
    width: 100%;
    height: 100%;
    display: flex;

    .nana {
        display: flex;
        width: 100%;
        height: 100%;
        align-items: center;
        justify-content: flex-end;

        img {
            width: 40px;
            height: 40px;
            border-radius: 50%;
        }
    }
}
</style>